package com.woniu.command.warehouseCommand;

import com.woniu.command.Command;
import com.woniu.command.handler.WarehouseCommandHandler;
import com.woniu.outlet.po.WarehousePo;
import com.woniu.utils.ApplicationContextHolder;

public class AddWarehouseCommand implements Command<WarehousePo, Integer> {

    private WarehouseCommandHandler handler;

    public AddWarehouseCommand() {
        //ApplicationContextHolder.getApplicationContext()拿到ApplicationContext
        this.handler = ApplicationContextHolder.getApplicationContext()
                .getBean(WarehouseCommandHandler.class);
    }

    @Override
    public Integer execute(WarehousePo warehousePo) {
        return this.handler.addWarehouse(warehousePo);
    }
}
